<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.*" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
    /**
     * @author 张天兴
     * @since 2009/05/31
     */
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
		<title>聋校备课与语言学习及矫治系统</title>
		<fmt:setBundle basename="PathResource" scope="session" />
		<link href="<%=request.getContextPath()%>/<fmt:message key='StylePath' />style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"
			src="<%=request.getContextPath()%>/<fmt:message key='jquery' />jquery.js"></script>
<script type="text/javascript">
function toStatic(obj){        
		var class_ = $("select[name='classNumber']").val();
		var selBasedOn=0;
		var picType = 0;
		var radios = document.getElementsByName("resultInput");
		var radios2 = document.getElementsByName("picType");
		var result = "";
		var result2="";
		for(var i=0;i<radios.length;i++){
			if(radios[i].checked){
				result=radios[i].value;
				break;
			}
		}
		if(result=="1") {selBasedOn=1;}
		if(result=="2") {selBasedOn=2;}
		for(var k=0;k<radios2.length;k++){
			if(radios2[k].checked){
				result2=radios2[k].value;
				break;
			}
		}
		if(result2=="1") {picType=1;}
		if(result2=="2") {picType=2;}		

		var serverUrl = "<%=request.getContextPath()%>/studpinggu.do?method=statisticsByResult";
		serverUrl+= "&classNumber="+class_;
		serverUrl+="&selBasedOn="+selBasedOn;	
		serverUrl+="&picType="+picType;

		var html1 = "<img style=\"width:400px;height:300px;\" border=\"0\" src=\""+serverUrl+"\">";
		$("#imageArea").html(html1);
				
		listStatisticsAjax();
	}
	
	function listStatisticsAjax(){
		var ajaxurl = "<%=request.getContextPath()%>/studpinggu.do?method=statisticsAsk";
		var params = getAjaxStatisticsParams();
		if(params=="") return;
		$.ajax({
		 url: ajaxurl,
		 type: 'POST',
		 dataType: 'html',
		 timeout: 20000,//超时时间设定
		 data:params,//参数设置
		 error: function(){alert('error');dialog.hide();},//错误处理
		 success: function(html){
		 	$("#rest").html(html);
		 }
		});

	}
	
	function getAjaxStatisticsParams(){
		var class_ = $("select[name='classNumber']").val();
		var selBasedOn=0;
		var picType = 0;
		var radios = document.getElementsByName("resultInput");
		var radios2 = document.getElementsByName("picType");
		var result = "";
		var result2="";
		for(var i=0;i<radios.length;i++){
			if(radios[i].checked){
				result=radios[i].value;
				break;
			}
		}
		if(result=="1") {selBasedOn=1;}
		if(result=="2") {selBasedOn=2;}
		for(var k=0;k<radios2.length;k++){
			if(radios2[k].checked){
				result2=radios2[k].value;
				break;
			}
		}
		if(result2=="1") {picType=1;}
		if(result2=="2") {picType=2;}		

		var serverUrl = "classNumber="+class_;
		serverUrl+="&selBasedOn="+selBasedOn;	
		serverUrl+="&picType="+picType;
		return serverUrl;
	}
</script>

<script  type="text/javascript">
	//alert(data);
	function statisticsonClick(radio){
		var result = document.forms[0].result;
		var score = document.forms[0].score;
		if(radio.value=="按评估结果"){
			result.disabled=!radio.checked;
			score.disabled=radio.checked;
		}
		if(radio.value=="按分数范围"){
			result.disabled=radio.checked;
			score.disabled=!radio.checked;
		}
	}	
</script>
	
	</head>
	<body >
		<html:form method="post" action="studpinggu.do?method=statisticsByResult">
  <table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#a7c8e6">
    <tr>
      <td><table width="100%" border="0" align="center" cellpadding="3" cellspacing="0" class="fontbot">
          <tr>
            <td align="left" valign="middle" bgcolor="#FFFFFF">&nbsp;班 级：<br /></td>
            <td align="left" valign="middle" bgcolor="#FFFFFF">
            <select name="classNumber" class="boxcopy2" style="width:100px;">
				<c:forEach items="${clazz}" var="vc" varStatus="status">
					<option value="<c:out value="${vc.classId }" />|0">
						<c:out value="${vc.grades.name }" /><c:out value="${vc.classNumber }" />班
					</option>
				</c:forEach>
				<c:forEach items="${specialGroups}" var="vc" varStatus="status">
					<option value="<c:out value="${vc.onlyClassId }|1" />">
						<c:out value="${vc.name }" />
					</option>
				</c:forEach>
            </select>
            </td>
            <td align="left" valign="middle" bgcolor="#FFFFFF">            
             请选择统计依据：</td>
            <td align="left" valign="middle" bgcolor="#FFFFFF">
            <input type="radio"  name="resultInput"   id="1" value="1" checked/>
             按评估结果</td>
            <td align="left" valign="middle" bgcolor="#FFFFFF">
            <input type="radio" name="resultInput"  id="2" value="2" />
             按分数范围</td>
           <td align="center" valign="middle" bgcolor="#FFFFFF">            
             请选择：</td>
            <td align="left" valign="middle" bgcolor="#FFFFFF"> 
            <input type="radio" name="picType"  id="0" value="1" checked/>
             生成柱形图</td>
            <td align="left" valign="middle" bgcolor="#FFFFFF">
			<input type="radio" name="picType"  id="1" value="2" />
             生成饼形图
            </td>
            <td valign="middle" bgcolor="#FFFFFF">
            <a href="javascript:toStatic(this);" onfocus="this.blur()">
            <img src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />jz_img/tongji.gif" width="53" height="22" border="0" />
			</a>
            </td>
          </tr>
      </table></td>
    </tr>
  </table>
  <table cellspacing="0" cellpadding="0" width="99%" align="center" border="0">
    <tbody>
      <tr>
        <td width="7"><img height="38" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_01.gif" 
      width="7" /></td>
        <td background="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_05.gif"><table cellspacing="0" cellpadding="0" width="100%" border="0">
            <tbody>
              <tr>
                <td width="30"><img height="38" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_02.gif" 
            width="30" /></td>
                <td align="left" width="200" 
            background="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_03.gif">&nbsp;<b>统 计 结 果</b></td>
                <td width="59"><img height="38" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_04.gif" 
            width="59" /></td>
                <td>&nbsp;</td>
              </tr>
            </tbody>
        </table></td>
        <td width="8"><img height="38" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_06.gif" 
      width="8" /></td>
      </tr>
      <tr>
        <td background="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_07.gif"><img height="1" 
      src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />spacer.gif" width="1" /></td>
        <td bgcolor="#f7fbff"><table cellspacing="1" bordercolordark="#ccccff" cellpadding="3" width="100%" 
      bgcolor="#cfe5f5" bordercolorlight="#ffffff" border="0">
            <tbody>
              <tr bgcolor="#a4c9ec">
                <td width="75%"  align="center" valign="middle" bgcolor="#FFFFFF"  id="imageArea">&nbsp;</td>
                <td  align="center"  bgcolor="#FFFFFF"  id="dataArea" valign="top">
                <table border="0" cellpadding="7" cellspacing="1"  bgcolor="#a7c8e6" id="rest"  >&nbsp;
				</table>
                </td>
              </tr>
            </tbody>
        </table>        </td>
        <td background="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_09.gif"><img height="1" 
      src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />spacer.gif" width="1" /></td>
      </tr>
      <tr>
        <td><img height="22" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_10.gif" width="7" /></td>
        <td background="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_11.gif">&nbsp;</td>
        <td><img height="22" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_12.gif" 
  width="8" /></td>
      </tr>
    </tbody>
  </table>
		</html:form>
	</body>
</html>
